<template>
	<view>
		<view style="padding: 10rpx;">
			<view style="font-size: 40rpx; line-height: 50rpx; font-weight: bolder;text-align: center;">{{title}}</view>
			<view style="font-size: 25rpx; line-height: 50rpx; text-align: center;">{{create_time}}</view>
			<view style="font-size: 30rpx; padding: 20rpx; line-height: 60rpx;" class="grace-margin-top">
			    <rich-text type="text" :nodes="content"></rich-text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type:'',
				id:'',
				title:'',
				create_time:'',
				summary:'',
				content:''
			}
		},
		onLoad(e) {
			this.id = e.id;
			this.type = e.type;
			this.getDataDetail();
		},
		methods: {
			getDataDetail(){
				uni.request({
					url: this.serverUrl + '/feiyan/search-api/getDataDetail',
					header: {
						"content-type": "application/x-www-form-urlencoded; charset=UTF-8"
					},
					data: {
						id: this.id,
						type: this.type
					},
					method: "POST",
					success: (r) => {
						// console.log(r);
						if (r.data.code == '000000') {
							this.title = r.data.data[0].title;
							this.create_time = r.data.data[0].create_time;
							if(r.data.data[0].content!=null){
								this.content = r.data.data[0].content.replace(/h2/g, "view").replace(/\\/g, "").replace(/style\s*?=\s*?([‘"])[\s\S]*?\1/g,"").replace(/<img/g,
										"<img style=\"width:100%; height: auto;\"").replace(/<!--(.*?)-->/g,"");
							}
							
						} else {
							uni.showToast({
								title: r.data.message
							});
						}
					}
				})
			}
		}
	}
</script>

<style>

</style>
